package admin

import (
	"booking/common/handler"
	"booking/models"
	"github.com/gin-gonic/gin"
)

func Info(c *gin.Context) {
	adminId := c.GetInt("id")
	var admin models.Admin
	models.Db.Model(models.Admin{}).
		Where(map[string]any{
			"id": adminId,
		}).
		First(&admin)
	if admin.Id == 0 {
		handler.Error("用户不存在", c)
		return
	}

	handler.Success(map[string]any{
		"id":           admin.Id,
		"username":     admin.Username,
		"mobile":       admin.Mobile,
		"nickname":     admin.Nickname,
		"updated_time": admin.UpdatedTime,
	}, c)

}
